package com.cjkj.equipment;

import com.cjkj.common.security.annotation.EnableCustomConfig;
import com.cjkj.common.security.annotation.EnableMSFeignClients;
import com.cjkj.equipment.handler.MonitorPadHandler;
import com.cjkj.equipment.handler.SmartBraceletHandler;
import com.cjkj.equipment.handler.TJ03Handler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@EnableCustomConfig
@EnableMSFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
@ComponentScan({"com.cjkj.*"})
public class EquipmentApplication {

    @Resource(name = "monitorPadHandler")
    MonitorPadHandler monitorPadHandler;

    @Resource(name = "smartBraceletHandler")
    SmartBraceletHandler smartBraceletHandler;

    @Resource
    TJ03Handler tj03Handler;

    private static EquipmentApplication application;
    @PostConstruct
    public void init() {
        application = this;
        application.monitorPadHandler = this.monitorPadHandler;
        application.smartBraceletHandler = this.smartBraceletHandler;
        application.tj03Handler = this.tj03Handler;
    }
    public static void main(String[] args) {
        SpringApplication.run(EquipmentApplication.class, args);
        application.monitorPadHandler.initAMQP();
        application.smartBraceletHandler.initAMQP();
        application.tj03Handler.initAMQP();
        System.out.println("(♥◠‿◠)ﾉﾞ  设备数据采集模块启动成功   ლ(´ڡ`ლ)ﾞ");
    }
}